﻿<UserControl x:Class="TravisLight.View.ListView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:converter="clr-namespace:TravisLight.View.Converter">

    <UserControl.Resources>
        <converter:StatusConverter x:Key="StatusConverter" />
        <BitmapImage x:Key="failed" UriSource="Images/failed.png" />
        <BitmapImage x:Key="passed" UriSource="Images/passed.png" />
        <BitmapImage x:Key="unknown" UriSource="Images/unknown.png" />
        <BitmapImage x:Key="building" UriSource="Images/building.png" />
    </UserControl.Resources>

    <ListBox ItemsSource="{Binding Path=Repositories}">
        <ListBox.ItemTemplate>
            <DataTemplate>
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="70" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50" />
                    </Grid.RowDefinitions>
                    <Image Source="{Binding Status, Converter={StaticResource StatusConverter}}" Grid.Column="0" Width="48" Height="48" />
                    <TextBlock Text="{Binding Slug}" Grid.Column="1" VerticalAlignment="Center" />
                </Grid>
            </DataTemplate>
        </ListBox.ItemTemplate>
    </ListBox>
</UserControl>
